home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 8 / Revista CD Expert nº 08 CD1.iso / Utilitarios / Especiais / PhotoSuite II / DATA1.CAB / English_Resources / HTMLComponent / TempPSII / Common / Activation.js < prev    next >
Encoding:
JavaScript  |  1999-01-08  |  14.6 KB  |  562 lines

  1. ////////////////////////////////////////////////////////////////
  2. //
  3. //    Activation.js
  4. //
  5. //     Activation mechanisms
  6. //
  7.  
  8. //    The activation IDs are encoded using the follwing method:
  9. //    
  10. //    ID is a 32-bit int:            0x87654321
  11. //
  12. //    nibble 8:    High bit (0x80000000):     Guided mode
  13. //            rest (0x70000000):        Main module:    0- Common stuff (like print preview)
  14. //                                                    1- Photo, 2- Projects, 3- Albums,
  15. //                                                    4- Motion, 5- Internet
  16. //
  17. //    nibble 7: Toolkit in module.    1-based. 0 is default or no action
  18. //    nibble 6: Toolkit flyout.        1-based. 0 is default or no action
  19. //
  20. //    nibble 2: Bitfield corresponding to the nibbles mentionned above. If bit is set, also tell
  21. //                LTK to physically click the button
  22. //    nibble 1: Extra option bits: 0x1:    Welcome page
  23. //                                 0x2:    Skip Welcome pages unconditionally
  24.  
  25. function _ALActivate( ID )
  26. {
  27.     switch( ID & 0xF0000000 ) {                                    // Get main module
  28.     case 0x00000000:                                            // Common Stuff
  29.         switch( ID & 0x0F000000 ) {
  30.         case 0x00000000:                                    // Default module
  31.             if( ID & 0x2 )        // Skip welcome page?
  32.             { 
  33.                 ID = ID & 0xFFFFFFFE;
  34.             }
  35.             else
  36.             {
  37.                 // Should we show Welcome page?
  38.                 nShowWelcome = LTKGetIntKeyValue( "HKEY_CURRENT_USER%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CUserSettings", "MainWelcomePage", 1 );
  39.                 nShowWelcome = parseInt( nShowWelcome );
  40.  
  41.                 if( isNaN( nShowWelcome ) )
  42.                 {
  43.                     nShowWelcome = 1;
  44.                 }
  45.  
  46.                 if( nShowWelcome )
  47.                 {
  48.                     ID = ID | 0x1;
  49.                 }
  50.             }
  51.  
  52.             if ( ID & 0x1 )                // Welcome page?
  53.             {
  54.                 // Make sure Photos is selected and reg key is accurate
  55.                 ALClickButton(0);
  56.  
  57.                 // Set up Welcome page
  58.                 RPASetTarget('../Photos/RightPaneA3.html' );
  59.                 WSetTarget('../Common/W_Welcome.html' );
  60.                 LTKTriggerEvent("file:/Resources/WorkflowsComponent!Photos!CommandBar.wkf,99,1" );
  61.                 break;                                 // Don't go further.
  62.             }
  63.  
  64.             // Get last mode
  65.             nLastButton = LTKGetIntKeyValue( "HKEY_CURRENT_USER%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CUserSettings", "LastActivityListButton", 0 );
  66.             nLastButton = parseInt( nLastButton );
  67.  
  68.             if( isNaN( nLastButton ) )
  69.             {
  70.                 nLastButton = 0;
  71.             }
  72.  
  73.             // Convert to activation ID
  74.             nLastButton = (nLastButton+1) << 28;
  75.             nLastButton = nLastButton | 0x80;
  76.  
  77.             _ALActivate(nLastButton);
  78.             break;
  79.  
  80.         case 0x01000000:                                    // Print Preview
  81.             RPASetTarget("../Common/RightPaneB2.html");
  82.             WSetTarget("../Common/W_PrintPreview.html");
  83.             BTSetTarget("../Common/BT_PrintPreview.html");
  84.             LTKTriggerEvent("file:/Resources/WorkflowsComponent!Common!CommandBar.wkf,99,0");
  85.             break;
  86.  
  87.         case 0x02000000:                                    // Print Photo Package
  88.             switch( ID & 0x00F00000 ) {
  89.             case 0x00000000:                            // Default action
  90.             case 0x00100000:                            // Select a template
  91.                 RPASetTarget("../Common/RightPaneB2.html");
  92.                 WSetTarget("../Common/W_PrintPackage.html");
  93.                 BTSetTarget("../Common/BT_PrintPackage.html");
  94.                 BTSetVisibility( 0x01 );
  95.                 LTKTriggerEvent("file:/Resources/WorkflowsComponent!Common!CommandBar.wkf,99,1");
  96.                 break;
  97.  
  98.             case 0x00200000:
  99.                 RPASetTarget("../Common/RightPaneB2.html");
  100.                 WSetTarget("../Common/W_PrintPackagePreview.html");
  101.                 BTSetTarget("../Common/BT_PrintPreview.html");
  102.                 LTKTriggerEvent("file:/Resources/WorkflowsComponent!Common!CommandBar.wkf,99,0");
  103.                 break;
  104.  
  105.             }
  106.             break;
  107.  
  108.         case 0x03000000:                                    // Send to PhotoNet
  109.             RPASetTarget("../Common/RightPaneA2.html");
  110.             WSetTarget("../Common/W_SendPhotoNet.html");
  111.             BTSetTarget("../Common/BTSendPhotoNet.html");
  112.             LTKTriggerEvent("file:/Resources/WorkflowsComponent!Common!CommandBar.wkf,99,1");
  113.             break;
  114.  
  115.         case 0x0F000000:                                    // About pages
  116.             showModalDialog("../Common/About.html", null, "dialogWidth:350px;dialogHeight:505px;help:no");
  117.             break;
  118.         }
  119.         break;
  120.  
  121.     case 0x10000000:                                            // Photo Module
  122.         if( ID & 0x00000080 )        // Click the button?
  123.         {
  124.             _ALClickButton(0);
  125.         }
  126.         
  127.         if ( ID & 0x1 )                // Welcome page?
  128.         {
  129.             // Set up Welcome page
  130.             RPASetTarget('../Photos/RightPaneA3.html');
  131.             WSetTarget( "../Photos/W_Welcome.html" );
  132.             RouteCall("WorkArea", "_WSetVisibility();");
  133.  
  134.             break;                                 // Don't go further.
  135.         }
  136.  
  137.         if( ( ID & 0x0F000000 ) != 0x01000000 )            // Anything but Get Photos
  138.         {
  139.             Context = LTKGetContext( 1 );
  140.             if( Context == -1 )                // Error, can't jump
  141.             {
  142.                 return;
  143.             }
  144.  
  145.             if( Context == 0 )                // No photo available
  146.             {
  147.                 // Call Wecome Page
  148.                 _ALActivate( ID | 0x1 );
  149.                 LTKTriggerEvent("file:/Resources/WorkflowsComponent!Photos!T_Paint.wkf,50,1;file:/Resources/WorkflowsComponent!Photos!CommandBar.wkf,99,1");
  150.                 break;
  151.             }
  152.         }
  153.  
  154.         // Sub
  155.         ActivatePhoto( ID );
  156.  
  157.         break;
  158.  
  159.     case 0x20000000:                                            // Projects Module
  160.         if( ID & 0x00000080 )        // Click the button?
  161.         {
  162.             _ALClickButton(1);
  163.         }
  164.  
  165.         if ( ID & 0x1 )                // Welcome page?
  166.         {
  167.             // Set up Welcome page
  168.             RPASetTarget('../Publish/RightPaneA3.html');
  169.             WSetTarget( "../Publish/W_Welcome.html" );
  170.             RouteCall("WorkArea", "_WSetVisibility();");
  171.  
  172.             break;                                 // Don't go further.
  173.         }
  174.  
  175.         // Sub
  176.         ActivateProjects( ID );
  177.         break;
  178.  
  179.     case 0x30000000:                                            // Album Module
  180.         if( ID & 0x00000080 )        // Click the button?
  181.         {
  182.             _ALClickButton(2);
  183.         }
  184.  
  185.         Context = LTKGetContext( 4 );
  186.         if( Context == -1 )                // Error, can't jump
  187.         {
  188.             return;
  189.         }
  190.  
  191.         if( Context == 0 )                // No album available
  192.         {
  193.             // Call Wecome Page
  194.             ID = ( ID | 0x1 );
  195.         }
  196.  
  197.         if ( ID & 0x1 )                // Welcome page?
  198.         {
  199.             // Set up Welcome page
  200.             RPASetTarget('../Album/RightPaneA3.html');
  201.             WSetTarget( "../Album/W_Welcome.html" );
  202.             RouteCall("WorkArea", "_WSetVisibility();");
  203.  
  204.             break;                                 // Don't go further.
  205.         }
  206.  
  207.         // Sub
  208.         ActivateAlbums( ID );
  209.         break;
  210.  
  211.     case 0x40000000:                                            // Slide Show Module
  212.         if( ID & 0x00000080 )        // Click the button?
  213.         {
  214.             _ALClickButton(3);
  215.         }
  216.  
  217.         Context = LTKGetContext( 3 );
  218.         if( Context == -1 )                // Error, can't jump
  219.         {
  220.             return;
  221.         }
  222.  
  223.         if( Context == 0 )                // No slideshow available
  224.         {
  225.             // Call Wecome Page
  226.             ID = ( ID | 0x1 );
  227.         }
  228.  
  229.         if ( ID & 0x1 )                // Welcome page?
  230.         {
  231.             // Set up Welcome page
  232.             RPASetTarget('../Motion/RightPaneA3.html');
  233.             WSetTarget( "../Motion/W_Welcome.html" );
  234.             RouteCall("WorkArea", "_WSetVisibility();");
  235.  
  236.             break;                                 // Don't go further.
  237.         }
  238.  
  239.         switch( ID & 0x00F00000 ) {
  240.         case 0x00500000:                                    // Print PhotoPackage
  241.             _ALActivate(0x02000000);
  242.             break;
  243.  
  244.         case 0x00600000:                                    // Send to PhotoNet
  245.             _ALActivate(0x03000000);
  246.             break;
  247.  
  248.         default:
  249.             RPASetTarget('../Motion/RightPaneA.html');
  250.             WSetTarget('../Motion/W_Motion.html');
  251.             BTSetTarget("../Motion/BuddyTools.html");
  252.             RouteCall("WorkArea", "RouteCall('BuddyTools', 'LTKTriggerEvent(\"file:/Resources/WorkflowsComponent!Motion!PM_Tools.wkf,1,1138\");' )" );
  253.         }
  254.  
  255.         break;
  256.  
  257.     case 0x50000000:                                            // Internet Module
  258.         if( ID & 0x00000080 )        // Click the button?
  259.         {
  260.             _ALClickButton(4);
  261.         }
  262.  
  263.         switch( ID & 0x0F000000 ) {
  264.         case 0x00000000:            // Default behavior
  265.             RPASetTarget('../Internet/RightPaneA3.html' );
  266.             WSetTarget("../Internet/W_Internet.html");
  267.             break;
  268.  
  269.         case 0x01000000:            // Directly to browser
  270.             RPASetTarget('../Internet/RightPaneA3.html' );
  271.             WSetTarget("../Internet/W_Internet.html");
  272.             break;
  273.         }
  274.         break;
  275.  
  276.     case 0x60000000:                                        // Guides
  277.         if( ID & 0x00000080 )        // Click the button?
  278.         {
  279.             _ALClickButton(5);
  280.         }
  281.         
  282.         RPASetTarget("../Guides/RightPaneA3.html");
  283.         WSetTarget("../Guides/index.html");
  284.  
  285.         break;
  286.         
  287.     default:
  288.         // Unknown!
  289.         alert( "Unknown Activation ID!" );
  290.     }
  291. }
  292.  
  293.  
  294. ////////////////////////////////////////////////////////////////
  295. //
  296. //    Sub functions
  297. //
  298.  
  299. function ActivatePhoto( ID )
  300. {
  301.     if( ID & 0x00000040 )                // Click the button?
  302.     {
  303.         TKClickButton((ID >> 28) & 0xF);
  304.     }
  305.  
  306.     switch( ID & 0xF000000 ) {
  307.     case 0x0000000:                        // Default
  308.         _ALActivate( 0x12000040 );
  309.         break;
  310.  
  311.     case 0x1000000:                        // Get Photo
  312.         switch( ID & 0xF00000 ) {
  313.         case 0x100000:                // From Computer
  314.             LTKTriggerEvent("CommandDispatcher,Active,20001");
  315.             break;
  316.  
  317.         case 0x200000:                // From Album
  318.             switch( ID & 0xF0000 ) {
  319.             case 0x00000:
  320.             case 0x10000:
  321.                 LTKTriggerEvent("CommandDispatcher,Active,20015");
  322.                 break;
  323.  
  324.             case 0x20000:
  325.                 RPASetTarget("../Photos/RightPaneA2.html");
  326.                 WSetTarget("../Photos/W_GetAlbum.html");
  327.                 BTSetTarget("../Photos/BTGetAlbum.html");
  328.                 LTKTriggerEvent("file:/Resources/WorkflowsComponent!Photos!CommandBar.wkf,99,3");
  329.                 break;
  330.             }
  331.             break;
  332.  
  333.         case 0x300000:                // From Camera
  334.             switch( ID & 0xF0000 ) {
  335.             case 0x00000:
  336.             case 0x10000:
  337.                 RPASetTarget('../Photos/RightPaneA2.html');
  338.                 BTSetTarget('../Photos/BTGetCamera.html');
  339.                 WSetTarget('../Photos/W_GetCamera.html');
  340.                 break;
  341.  
  342.             case 0x20000:
  343.                 // Get currently selected camera
  344.                 sCamera = LTKGetKeyValue( "HKEY_LOCAL_MACHINE%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CLiquid Toolkit%5CPreferences", "CurrentCameraKey", "" );
  345.                 if(sCamera)
  346.                 {
  347.                     sFile = LTKGetKeyValue( "HKEY_LOCAL_MACHINE%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CLiquid Toolkit%5CInput Device Configs%5C"+sCamera, "ControlCameraPage", "" );
  348.  
  349.                     if(sFile)
  350.                     {
  351.                         BTSetTarget("../Photos/CameraCtrl/"+sFile);
  352.                     }
  353.                 }
  354.                 break;
  355.             }
  356.             break;
  357.  
  358.         case 0x400000:                // From Twain
  359.             switch( ID & 0xF0000 ) {
  360.             case 0x00000:
  361.             case 0x10000:
  362.                 RPASetTarget('../Photos/RightPaneA2.html');
  363.                 BTSetTarget('../Photos/BTGetTwain.html');
  364.                 WSetTarget('../Common/W_Empty.html');
  365.                 break;
  366.  
  367.             case 0x20000:
  368.                 WSetTarget('../Photos/W_GetTwain.html');
  369.                 break;
  370.             }
  371.             break;
  372.  
  373.         case 0x500000:                // From PhotoNet
  374.             RPASetTarget('../Photos/RightPaneA2.html');
  375.             BTSetTarget('../Photos/BTGetPhotoNet.html');
  376.             WSetTarget('../Photos/W_GetPhotoNet.html');
  377.             break;
  378.         
  379.         case 0x600000:                // New
  380.             LTKTriggerEvent("CommandDispatcher,Active,20020");
  381.             break;
  382.  
  383.         }
  384.         break;
  385.  
  386.     case 0x2000000:                        // Edit
  387.         RPASetTarget('../Photos/RightPaneA.html');
  388.         BTSetTarget('../Photos/BuddyTools.html');
  389.         WSetTarget('../Photos/W_Paint.html');
  390.         RouteCall("WorkArea", "RouteCall('Tools', 'BTSetPaintMode(-1);');" );
  391.         RouteCall("WorkArea", "TClickButton(-1);" );
  392.         break;
  393.  
  394.     case 0x3000000:                        // Size and rotate
  395.         RPASetTarget('../Photos/RightPaneA.html');
  396.         BTSetTarget('../Photos/BuddyTools.html');
  397.         WSetTarget('../Photos/W_Paint.html');
  398.         // Zoom to fit when W_Paint is loaded
  399.         RouteCall("WorkArea", "LTKTriggerEvent('CommandDispatcher,BroadcastCommand,20063');" );
  400.         RouteCall("WorkArea", "TClickButton(2);" );
  401.         break;
  402.  
  403.     case 0x4000000:                        // Touchup/effects
  404.         switch( ID & 0xF00000 ) {
  405.         case 0x100000:                // Touchups
  406.             RPASetTarget('../Photos/RightPaneA.html');
  407.             BTSetTarget('../Photos/BTSpecialFx.html');
  408.             WSetTarget('../Photos/W_SpecialFx.html');
  409.             BTSetVisibility(0x2000);
  410.             RouteCall("WorkArea", "TClickButton(-1);" );
  411.             break;
  412.  
  413.         case 0x200000:                // Special Fx
  414.             RPASetTarget('../Photos/RightPaneA.html');
  415.             BTSetTarget('../Photos/BTSpecialFx.html');
  416.             WSetTarget('../Photos/W_SpecialFx.html');
  417.             BTSetVisibility(0x2020);
  418.             RouteCall("WorkArea", "TClickButton(-1);" );
  419.             break;
  420.             
  421.         case 0x300000:                // Warps
  422.             RPASetTarget("../Photos/RightPaneA.html");
  423.             WSetTarget("../Photos/W_Warp.html");
  424.             BTSetTarget("../Photos/BTWarp.html");
  425.             RouteCall("WorkArea", "TClickButton(-1);" );
  426.             break;
  427.  
  428.         case 0x400000:                // Remove Red Eye
  429.             RPASetTarget('../Photos/RightPaneA.html');
  430.             BTSetTarget('../Photos/BuddyTools.html');
  431.             WSetTarget('../Photos/W_Paint.html');
  432.             RouteCall("WorkArea", "RouteCall('Tools', 'BTSetPaintMode(6);');" );
  433.             RouteCall("WorkArea", "TClickButton(7);" );
  434.             TKClickButton(0x10000001);        // **Change Value to ** Show edit toolkit button again.
  435.             break;
  436.         }
  437.         break;
  438.  
  439.     case 0x5000000:                        // Save and Print
  440.         switch( ID & 0xF00000 ) {
  441.         case 0x400000:                // Print Preview
  442.             _ALActivate( 0x01000000 );
  443.             break;
  444.  
  445.         case 0x500000:                // Print Photo Package
  446.             _ALActivate( 0x02000000 );
  447.             break;
  448.  
  449.         case 0x800000:                // Send to PhotoNet
  450.             _ALActivate( 0x03000000 );
  451.             break;
  452.  
  453.         }
  454.         break;
  455.  
  456.     default:
  457.         alert( "Unknown Activation ID!" );
  458.     }
  459. }
  460.  
  461. function ActivateProjects( ID )
  462. {
  463.     if( ID & 0x00000040 )                // Click the button?
  464.     {
  465.         TKClickButton( ((ID >> 28) & 0xF) - 1 );
  466.     }
  467.  
  468. //    Note: Those IDs are a little different. The toolkit is not enumerated
  469. //    like for other modules. Rather, it is divided in categories, independant
  470. //    of the toolkit organization.
  471.  
  472.     switch( ID & 0xF000000 ) {
  473.     case 0x0000000:                        // Default
  474.         Context = LTKGetContext( 2 );
  475.         if( Context == -1 )                // Error, can't jump
  476.         {
  477.             return;
  478.         }
  479.  
  480.         if( Context == 0 )                // No photo available
  481.         {
  482.             // Call Wecome Page
  483.             _ALActivate( ID | 0x1 );
  484.             break;
  485.         }
  486.  
  487.         RPASetTarget('../Publish/RightPaneA.html');
  488.         BTSetTarget("../Publish/BuddyTools.html");
  489.         WSetTarget("../Publish/W_Publish.html");
  490.         RouteCall("WorkArea", "TClickButton(-2);" );
  491.         LTKTriggerEvent("file:/Resources/WorkflowsComponent!Publish!T_Publish.wkf,50,1;file:/Resources/WorkflowsComponent!Publish!CommandBar.wkf,99,1");
  492.         break;
  493.  
  494.     case 0x2000000:                        // All Templates
  495.         RPASetTarget('../Publish/RightPaneA2.html');
  496.         BTSetTarget("../Publish/BTGetTemplate.html");
  497.         WSetTarget("../Publish/W_GetTemplate.html");
  498.         LTKTriggerEvent("file:/Resources/WorkflowsComponent!Publish!CommandBar.wkf,99,2");
  499.  
  500.         switch( ID & 0xF00000 ) {
  501.         case 0x100000:                // Yearly Calendar
  502.             BTSetVisibility(0x20);
  503.             break;
  504.         case 0x200000:                // Quarterly Calendar
  505.             BTSetVisibility(0x40);
  506.             break;
  507.         case 0x300000:                // Monthly Calendar
  508.             BTSetVisibility(0x30);
  509.             break;
  510.         default:                    // All other templates
  511.             BTSetVisibility(0x10);
  512.             break;
  513.         }
  514.         break;
  515.  
  516.     case 0x3000000:                        // Save and print
  517.         switch( ID & 0xF00000 ) {
  518.         case 0x400000:                // Print Preview
  519.             _ALActivate( 0x01000000 );
  520.             break;
  521.  
  522.         case 0x500000:                // Print photo package
  523.             _ALActivate(0x02000000);
  524.             break;
  525.  
  526.         case 0x800000:                // Send to PhotoNet
  527.             _ALActivate(0x03000000);
  528.             break;
  529.  
  530.         }
  531.         break;
  532.     }
  533. }
  534.  
  535.  
  536. function ActivateAlbums( ID )
  537. {
  538.     if( ID & 0x00000040 )                // Click the button?
  539.     {
  540.         TKClickButton( ((ID >> 28) & 0xF) - 1 );
  541.     }
  542.  
  543.     switch( ID & 0xF000000 ) {
  544.     case 0x0000000:                        // Default
  545.         RPASetTarget("../Album/RightPaneA.html");
  546.         WSetTarget("../Album/W_Album.html");
  547.         BTSetTarget("../Album/BuddyTools.html");
  548.         break;
  549.  
  550.     case 0x1000000:                        // Get/Share
  551.         switch( ID & 0xF00000 ) {
  552.         case 0x300000:                // Print photo package
  553.             _ALActivate(0x02000000);
  554.             break;
  555.  
  556.         case 0x500000:                // Send to PhotoNet
  557.             _ALActivate(0x03000000);
  558.             break;
  559.         }
  560.         break;
  561.     }
  562. }